dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT([qd],[0.1.0],[acastro@bifi.es],[qd])
AM_INIT_AUTOMAKE

dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
AM_CONFIG_HEADER(config.h)

AC_SUBST(VERSION)

ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)

AC_CANONICAL_HOST

dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_FC([],Fortran 90)
AC_FC_LIBRARY_LDFLAGS
AC_LANG_PUSH(Fortran)
AC_FC_SRCEXT(f90)
ACX_FCFLAGS
AC_LANG_PREPROC
AC_FC_WRAPPERS

dnl Checks for libraries.

ACX_BLAS([], AC_MSG_ERROR([could not find required blas library]))
ACX_LAPACK([], AC_MSG_ERROR([could not find required lapack library]))
ACX_FFT
ACX_FC_COMMAND_LINE_ARGUMENTS
dnl check for GSL
AC_LANG_POP(Fortran)
AC_LANG_PUSH(C)
dnl WARNING: The acx_save_libs has to be properly done.
LIBS="${acx_save_libs}"
AM_PATH_GSL([1.0],
  [CFLAGS="$CFLAGS $GSL_CFLAGS"],
  AC_MSG_ERROR([could not find required gsl library]))
LIBS="${FCLIBS}"
AC_LANG_POP(C)

AC_LANG_PUSH(Fortran)
AC_LANG_POP(Fortran)

dnl Checks for header files.
AC_HEADER_STDC

AC_CHECK_HEADERS(unistd.h sys/param.h sys/time.h time.h sys/mkdev.h sys/sysmacros.h string.h memory.h fcntl.h dirent.h sys/ndir.h ndir.h alloca.h locale.h )

dnl jm_CHECK_TYPE_STRUCT_UTIMBUF
AC_HEADER_MAJOR
AC_FUNC_ALLOCA
AC_STRUCT_TM
AC_STRUCT_ST_BLOCKS
AC_FUNC_CLOSEDIR_VOID
AC_CHECK_FUNCS([mkfifo getopt_long])
AC_CHECK_FUNC(mknod)
dnl AC_CHECK_HEADER(argp.h,,AC_MSG_ERROR(Cannot continue: argp.h not found))
dnl AC_CHECK_LIB(argp, argp_parse, [LIBS="$LIBS -largp"],,)

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.

AC_CONFIG_FILES([Makefile qd.lsm qd.spec src/Makefile doc/Makefile])

AC_OUTPUT

